package cn.codergege.demo.controller

import cn.codergege.demo.service.PersonService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class HelloController {

    @Autowired
    lateinit var personService: PersonService

    private val log = LoggerFactory.getLogger(javaClass)

    @GetMapping(*arrayOf("/hello", "/hi"))
    fun hello(): Any? {
        log.info("Hello world! ...")
        val persons = personService.findPersonsByGender(1)
        persons?.forEach(::println)
        return persons
    }
}
